﻿using Furion.DynamicApiController;
using HOPU.OnlineSchool.Application.User.Dtos;
using HOPU.OnlineSchool.Application.User.Services;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace HOPU.OnlineSchool.Application.User
{
    public  class UserAppService : IDynamicApiController
    {
        private readonly IUserService _userService;

        public UserAppService(IUserService userService)
        {
            _userService = userService;
        }

        /// <summary>
        /// 用户登录
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<LoginInfoOutput> Login([FromBody] LoginInfoInput input)
        {
            return await _userService.LoginAsync(input);
        }

        /// <summary>
        /// 获取用户信息（临时处理，后期替换）
        /// </summary>
        /// <returns></returns>
        public UserInfoDto GetInfo()
        {
            var dto = new UserInfoDto()
            {
                Avatar = "",
                Name = "孙悟空",
                Roles = new string[] { "Admin" }

            };

            return dto;
        }
    }
}
